<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="Alexander.Li">

    <title>管理后台</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- MetisMenu CSS -->
    <link href="/static/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="/static/dist/css/sb-admin-2.css" rel="stylesheet">
    <!-- Morris Charts CSS -->
    <link href="/static/vendor/morrisjs/morris.css" rel="stylesheet">
    <!-- Custom Fonts -->
    <link href="/static/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">管理后台</a>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li>
                            <a href="javascript:void(1);" data-toggle="modal" data-target="#pwdModal"><i class="fa fa-gear fa-fw"></i> 修改登录密码</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="{{ url_for('admin.do_logout') }}"><i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>
                <!-- /.dropdown -->
            </ul>
            <!-- /.navbar-top-links -->

            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">
                        <li class="sidebar-search">
                            <form action="">
                            <div class="input-group custom-search-form">

                                    <input type="hidden" name="p" value="{{ pid }}">
                                <input name="name" type="text" class="form-control" placeholder="Search..." value="{{ name }}">
                                <span class="input-group-btn">
                                <button class="btn btn-default" type="submit">
                                    <i class="fa fa-search"></i>
                                </button>
                                </span>

                            </div>
                                 </form>
                            <!-- /input-group -->
                        </li>
                        <li>
                            <a href="{{ url_for('admin.main') }}"><i class="fa fa-dashboard fa-fw"></i> 管理首页</a>
                        </li>
                        <li>
                            <a href="{{ url_for('admin.manage_teams') }}"><i class="fa fa-table fa-fw"></i> 注册管理</a>
                        </li>
                        <li>
                            <a href="{{ url_for('admin.manage_check_points') }}"><i class="fa fa-edit fa-fw"></i> 签到点管理</a>
                        </li>
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>

        <div id="page-wrapper">

            <div class="row">
                <div class="col-lg-12">
                    <h3 class="page-header">{% block func_name %}{% endblock %}</h3>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            {% block content %}
            {% endblock %}
            
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->
    <div class="modal fade" id="pwdModal" tabindex="-1" role="dialog" aria-labelledby="changePwdModal" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form id="pwdForm">
          <div class="modal-header">
            <h5 class="modal-title" id="changePwdModal">修改登录密码</h5>
          </div>
          <div class="modal-body">
              <div class="form-group">
                <label for="oldPwd">当前密码</label>
                <input name="pwd" type="password" class="form-control" id="oldPwd" placeholder="输入当前密码">
              </div>
              <div class="form-group">
                <label for="newPwd">新的密码</label>
                <input name="new_pwd" type="password" class="form-control" id="newPwd" placeholder="输入新密码">
              </div>
              <div class="form-group">
                <label for="repeatPwd">重复密码</label>
                <input name="re_pwd" type="password" class="form-control" id="repeatPwd" placeholder="再次输入密码">
              </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="submit" class="btn btn-primary">保存变更</button>
          </div>
            </form>
        </div>
      </div>
    </div>

    <!-- jQuery -->
    <script src="/static/vendor/jquery/jquery.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="/static/vendor/bootstrap/js/bootstrap.min.js"></script>
    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/vendor/metisMenu/metisMenu.min.js"></script>
    <!-- Morris Charts JavaScript -->
    <script src="/static/vendor/raphael/raphael.min.js"></script>
    <script src="/static/vendor/morrisjs/morris.min.js"></script>
    <!-- Custom Theme JavaScript -->
    <script src="/static/dist/js/sb-admin-2.js"></script>
    <script>
       $("#pwdForm").submit(function (e) {
          e.preventDefault();
          $.post('{{ url_for("admin.reset_password") }}', $(this).serialize(), function (resp) {
              if (resp.code!=200){
                  alert(resp.error)
              }else{
                  alert("密码修改成功");
                  location.reload()
              }
          }, 'json')

       })
    </script>
    {% block script %}{% endblock %}

</body>

</html>
